package com.app.Activity;

import java.io.File;

import it.unipr.ce.dsg.s2p.sip.Address;

import com.app.Controller.NetworkController;
import com.app.Controller.ReadWriteFileController;

import android.app.Activity;
import android.app.NotificationManager;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import app.com.ModuleRole.R;

public class frmNotificationMoiVaoNhom extends Activity {
	Button btnDongY;
	Button btnTuChoi;
	public static Runnable raFinish;
	public static Runnable raStarNhomCho;

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.layout_moi_vao_nhom);

		btnDongY = (Button) findViewById(R.id.btnDongY);
		btnTuChoi = (Button) findViewById(R.id.btnTuChoi);

		btnDongY.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				File f=new File(ReadWriteFileController.MEMBER_PATH);
				f.delete();
				NetworkController.sendDongYVaoNhom(new Address(NetworkController.sender));
				// finish();
			}
		});

		NotificationManager mn = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
		mn.cancel(getIntent().getExtras().getInt("ID"));
		raFinish = new Runnable() {
			@Override
			public void run() {
				myFinish();
			}
		};
		raStarNhomCho = new Runnable() {
			@Override
			public void run() {
				Intent i = new Intent(getBaseContext(), frmNhomChoActivity.class);
				startActivity(i);
				myFinish();
			}
		};
	}

	private void myFinish() {
		this.finish();
	}
}
